package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既户私钥是您的APPID对应支付宝账号
	public static String app_id ="2016092600600068";
	
	// 商，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCW5kF8UVy463i1ayEVZETxaQWB0Kj+Fwvtiu1oyRvbFHCPC4pbO4f+N3tQiSVn200Ylwv8n9AGMjceg36t3JwgpTYIjiqT9dyDYIQ4VdapYRIZynnhXTtp0YDsw0A8LCh+YxiRCGX9nX9/8DQshNLo9ltrNBzxvwrxW1FfhO3NaNeiAd5Vm3DxC5PtuG+PrtaHrVZMG7XoiMykx1pVh7COpBkd4SiLX484tmoa2TzF/u1X1oL6jDwv19opSh7II2qJXPj5s6J6PUndjPR+km/bl48/c2q22ukEYsDPFi3dcLE0h5DGw3RRgselStP6OOMRhn+Aht/MiNQsIrapRN4RAgMBAAECggEAN2mCbqZqCDXf867NTU+uyX+pWAxJolTQOoCjwbDoG8EbvEuemPX5cG7rR521MLglTXxaGICPIVdbSkc7Q5kZdBt3Bhk+pWrJeSz+ILnUxAozXWku7IUSBj+6ujbQ5cfJbu/w24FcAo/NfCu23QpBcO7Wjz1py5Q97nd8IDluIdlny/hxsUFzjiZ2T4pB8HPahZm5yDFyIrwplRGgR93W3VvKWLXTDL9jn9cYjaL5YQ8Y4VgYJB0nhhjGS6J3gi0D9oEwKtwIdSXci3byBCZf3eIjmoZ3eyGdfK7aFjRQAAIsWtHj2WuVH8shrsqhkvUFsdhASCneQw+011GXRIzoaQKBgQDFB+cSHQs40hoRkQYEr0jUZDfqIxuvspajzHDvXe9K8XRNfkhAMvhZGsjUrt7Tfj4LbBag38TyuSBPq9NqUGF//CSYwMDellQuzsHo7Sd0IugOGOqf+mvrhX1dNgkMFGVmzY859FO9Orj4zZT6YgRzR+edWhFaoxVg9fgD0++5ywKBgQDED9u4saBQzc0Pf9DNsMmgxPl7X12Q8SPVOM5Z2KkRkNGtv4zeXIEpqHZKogrjcKN7OPzyjD6fD3Id9nzylV3REcruVnnC4LdIh32cPxn38/p7gXDhA9zePWMi6UDObVkGZbZWZ2MzJjBF6yxpI+OV3DyXpDETE488awJFKPu8EwKBgExFxOO0LpXub30BYQ0LNexSZ3rR4HPhdIMwLz/aYznlwpoFGr8PfCgyQDBlCYlhw270hsX8GefEVofBAnSTbUr4NsqTQ5ZnJ2t/Sn164N0Kbj6W0qzfakugP2mH83SjqKVlSd6rgIcuZlCadOOAciyWV0kIhtNJcos4bKw+rPyFAoGAQPmccIX1QjIh7iwGr9QRzgTZRSiiooE3xdbwk9f4l8itpG4hqiNv7rVUloFDKILQuup08ZDGxAHjaMiiOeaEU+AYp4njClFcjF3So/BJk+G4Niv8k6WrEb+4Vf6FKqQUZ8lXdyUGPBJA1zsL2cA6ERUOw5Z3aQIHaxdvhioB2x8CgYBvrJOYbBJqrCCtNaEKesbVnKJmpNlbbXUbwHuDbpgb6YCzHO0kFjX/6Dh7jyAbB1ZCW4BmvdtpI5YypPi1ErZpHQV3KeRvlKKc5L6I75E8p1y6le45GHjO67+16YdqDeiSpQaAfs7GfRdmcNofuX0rnRHkzs8Sflgp6BLSg5FLsA==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0KJQmcVc5zNtlFCPr0PDXcV3W4DpP84hnFIMouVl/A5O7KS3uaI0UE8SOmVeCABVK9Ld4UrGlnMRkFxQObdJcIIg1D7Xd0OTegNB8DJoY9LhLV9I3xNtUezEe6PavkqyxEniOQEQzlYrvFdtiOZViVJYvYlWHoxSif30hNvAnaPCfqT3TOvbBztxMqWlFmTLgBhW9CX8Joj2zXYxwOhmmShEH5y6pWbMUrE/tPI0skhiMDu2+WEqi2NJ/4CXhJe1mCTGLE7FY6N1w8zPojOwStdMCVcjC1avYDZ3hcXq291wLKlhxL5FHF/7LUpszl4lQL8V9Cts0r/tYCYP7ggk3wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	

	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

